const { ccclass, property } = cc._decorator;

@ccclass
export default class goodsControl extends cc.Component {
    @property(cc.Button)
    buy: cc.Button = null;
    @property(cc.Button)
    ads: cc.Button = null;
    @property(cc.Label)
    nameLabel: cc.Label = null;
    @property(cc.Label)
    describe: cc.Label = null;
    @property(cc.Label)
    money: cc.Label = null;
    @property(cc.Label)
    xiangou: cc.Label = null;
    @property(cc.Label)
    size: cc.Label = null;
    @property(cc.Sprite)
    goodSprite: cc.Sprite = null;
    @property
    xgCount: number = 0;
    @property
    xgUsed: number = 0;
    @property
    xgType: number = 0;
    @property
    xgSize: number = 0;

    @property
    _Key: string = "hero";
    @property
    _Id: string = "";

    timeStr: string[] = ["每天", "每周", "每月", "永久"];

    onLoad() {
        this.showXg()
    }
    showXg() {
        if (this.xgCount == this.xgUsed)
            this.buy.node.active = false;
        this.xiangou.string = this.xgUsed + "/" + this.xgCount + this.timeStr[this.xgType];
    }
}
